﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Admin/Admin2.master" AutoEventWireup="true" CodeFile="QuanLyTinTuc.aspx.cs" Inherits="Admin_QuanLyTinTuc" %>
<%@ Register assembly="CKEditor.NET" namespace="CKEditor.NET" tagprefix="CKEditor" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
    <style type="text/css">
        .style1
        {
            height: 20px;
        }
        .style2
        {
            height: 40px;
        }
        .style3
        {
            height: 20px;
            width: 70px;
        }
        .style4
        {
            height: 40px;
            width: 70px;
        }
        .style5
        {
            width: 70px;
        }
        .style6
        {
            width: 70px;
            height: 145px;
        }
        .style7
        {
            height: 145px;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <asp:MultiView ID="MultiView1" runat="server">
        <asp:View ID="View1" runat="server">
       <div align="center"> <asp:GridView ID="gvTinTuc" runat="server" AutoGenerateColumns="False" 
                         Width="1000px" BorderColor="#D2D2D2" 
                        BorderStyle="Solid" BorderWidth="1px" AllowPaging="True" 
                    AllowSorting="True" CellPadding="2" CellSpacing="3" DataKeyNames="MaTT" 
                    PageSize="5" onpageindexchanging="gvTinTuc_PageIndexChanging" 
                onrowcommand="gvTinTuc_RowCommand" onrowdatabound="gvTinTuc_RowDataBound" 
                onrowediting="gvTinTuc_RowEditing" onrowdeleting="gvTinTuc_RowDeleting">
                        <Columns>
                            <asp:BoundField DataField="MaTT" HeaderText="Mã TT" 
                                SortExpression="MaTT" >
                            <ItemStyle Width="40px" />
                            </asp:BoundField>
                            <asp:BoundField DataField="TieuDe" HeaderText="Tiêu Đề" 
                                SortExpression="TieuDe" >
                            <ControlStyle Width="100px" />
                            <ItemStyle Width="100px" />
                            </asp:BoundField>
                            <asp:BoundField DataField="MoDau" HeaderText="Mở Đầu" SortExpression="MoDau" 
                                HtmlEncode="False" HtmlEncodeFormatString="False" >
                            <ControlStyle Width="300px" />
                            <ItemStyle Width="300px" />
                            </asp:BoundField>
                            <asp:BoundField DataField="TenLoai" HeaderText="Loại Tin" 
                                SortExpression="TenLoai" >
                            <ItemStyle Width="60px" />
                            </asp:BoundField>
                            <asp:TemplateField HeaderText="Ảnh Minh Họa">
                                <ItemTemplate>
                                    <asp:Image ID="imgTT" runat="server" 
                                        ImageUrl='<%# "images/QC/"+Eval("HinhAnh") %>' Height="40px" Width="40px" />
                                </ItemTemplate>
                                <ItemStyle Width="100px" />
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="Chọn">
                                <ItemTemplate>
                                <div style="vertical-align:middle;margin-left:10px;">
                                <asp:LinkButton ID="LinkButton2" CssClass="btnicon2" runat="server" 
                                        CommandName="Delete" 
                                        OnClientClick="return confirm('Bạn có chắc chắn muốn xóa tin tức này không?');" 
                                        ToolTip="Xóa tin tức"></asp:LinkButton>
                                    <asp:LinkButton ID="LinkButton1" CssClass="btnicon1" runat="server" 
                                        CommandName="Edit" ToolTip="Sửa tin tức" 
                                        CommandArgument='<%# Eval("MaTT") %>'></asp:LinkButton>
                                    
                                    <!--<asp:LinkButton ID="LinkButton3" CssClass="btnicon3" runat="server"></asp:LinkButton>
                                    <asp:LinkButton ID="LinkButton4" CssClass="btnicon4" runat="server"></asp:LinkButton>
                                    <asp:LinkButton ID="LinkButton5" CssClass="btnicon5" runat="server"></asp:LinkButton>-->
                                    </div>
                                </ItemTemplate>
                                <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="120px" />
                            </asp:TemplateField>
                        </Columns>
                        <HeaderStyle BackColor="#666666" BorderColor="#D2D2D2" BorderStyle="Solid" 
                            BorderWidth="1px" Font-Bold="True" ForeColor="White" Height="50px" />
                        <PagerStyle CssClass="pagerstyle" />
                        <RowStyle Height="30px" HorizontalAlign="Center" VerticalAlign="Middle" />

                    </asp:GridView></div><br />
                    <table width="100%"><tr align="center"><td>
                <asp:Label ID="lbloi" runat="server" ForeColor="Red"></asp:Label>
                        <br />
                <br />
               <div align="center"> <asp:Button ID="btThemmoi" 
                    runat="server" Text="Thêm M&#7899;i" onclick="btThemmoi_Click" Height="25px" 
                       Width="100px"/></div>
                        <br />
                        </td></tr></table>
        </asp:View>
        <asp:View ID="View2" runat="server">
        <table>
            <tr>
                <td class="style5">
                </td>
                <td>
                    <asp:HiddenField ID="hdmatt" runat="server" />
                </td>
            </tr>
            <tr>
                <td class="style3">Tiêu &#273;&#7873;:</td>
                <td class="style1">
                    <asp:TextBox ID="tbtieude" runat="server" TextMode="MultiLine" Width="80%"></asp:TextBox>
                    
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator5" runat="server" 
                        ControlToValidate="tbtieude" ErrorMessage="*" ForeColor="Red"></asp:RequiredFieldValidator>
                    
                    <br />
                    <br />
                    
                    <br />
                    
                </td>
            </tr>
            <tr>
                <td class="style5">Mở Đầu:</td>
                <td>
                    <CKEditor:CKEditorControl ID="txtMoDau" runat="server"></CKEditor:CKEditorControl>
                    
                    <asp:Label ID="lbMoDau" runat="server" ForeColor="Red"></asp:Label>
                    <br />
                    
                    <br />
                    
                    <br />
                    
                    </td>
            </tr>
            
            <tr>
                <td class="style5">N&#7897;i Dung:</td>
                <td>
                    <CKEditor:CKEditorControl ID="txtnoidung" runat="server"></CKEditor:CKEditorControl>
                    
                    <asp:Label ID="lbloinoidung" runat="server" ForeColor="Red"></asp:Label>
                    <br />
                    
                    <br />
                    
                    <br />
                    
                    </td>
            </tr>
            <tr>
                <td class="style4">Lo&#7841;i tin:</td>
                <td class="style2">
                    <asp:DropDownList ID="cbloaitin" runat="server" Height="19px">
                        
                    </asp:DropDownList>
                    </td>
            </tr>
            <tr>
                <td class="style4">Hình &#7842;nh:</td>
                <td class="style2">
                    <asp:FileUpload ID="flhinh" runat="server" Width="232px" />
                    <asp:RequiredFieldValidator ID="regularFileHinh1" runat="server" 
                        ControlToValidate="flhinh" ErrorMessage="*" ForeColor="Red"></asp:RequiredFieldValidator>                        
                    <asp:RegularExpressionValidator ID="regularFileHinh2" runat="server" 
                        ControlToValidate="flhinh" ErrorMessage="Không ph&#7843;i file &#7843;nh" 
                        
                        ValidationExpression="^([0-9a-zA-Z_\-~ :\\])+(.jpg|.JPG|.jpeg|.JPEG|.bmp|.BMP|.gif|.GIF|.png|.PNG)$" 
                        ForeColor="Red"></asp:RegularExpressionValidator>
                        
                    <br />
                    <asp:Label ID="lbloidungluong" runat="server" ForeColor="Red"></asp:Label>
                        
                </td>
            </tr>
            <tr>
                <td class="style4">Hiện:</td>
                <td class="style2">
                    <asp:CheckBox ID="cbAn" runat="server"/></td>
            </tr>
            <tr>
                <td class="style6"></td>
                <td class="style7">
                    <asp:Image ID="imageMinhHoa" runat="server" Height="130px" Width="130px" />
                    <asp:HiddenField ID="hdhinh" runat="server" />
                </td>
            </tr>
            <tr>
                <td class="style4">
                    <asp:Button ID="btthem" runat="server" Text="Thêm" onclick="btthem_Click" 
                        Height="25px" Width="50px" />
                  
                </td>
                <td class="style2" align="center">
                    <asp:Button ID="btcapnhat" runat="server" onclick="btcapnhat_Click"  
                        Text="C&#7853;p Nh&#7853;t" Height="25px" Width="90px" />
                </td>
            </tr>
        </table>
        </asp:View>
    </asp:MultiView>
</asp:Content>

